package com.deyuanyun.pic.integalz.controller;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.deyuanyun.pic.common.util.ajax.AjaxSupport;
import com.deyuanyun.pic.integalz.controller.dto.IntegalzQueryVO;
import com.deyuanyun.pic.integalz.service.PipeHighDepthService;
import com.deyuanyun.pic.settings.controller.BaseController;

/**
 *  
 *  @author axiao(xj08.dream@gmail.com)
 *  @date 2016-11-16
 *  @version 1.0
 *  Histroy: [修改人][时间][描述]
 */
@Controller
@RequestMapping("/integalz")
public class BasicPipeHighDepthController extends BaseController{

    @Autowired
    private PipeHighDepthService pipeHighDepthService;

    /**
     * 统计管道高程
     * @param queryVO
     * @return 
     * @author axiao(xj08.dream@gmail.com)
     * @date 2016-11-16
     */
    @RequestMapping("/pipeHigh/query.json")
    @ResponseBody
    public void queryHigh(IntegalzQueryVO queryVO) {
        AjaxSupport.sendSuccessText("success", pipeHighDepthService.queryPipeHigh(queryVO));
    }

    /**
     * 统计管道埋深
     * @param queryVO
     * @return
     * @author axiao(xj08.dream@gmail.com)
     * @date 2016-11-16
     */
    @RequestMapping("/pipeDepth/query.json")
    @ResponseBody
    public void queryPipeDepth(IntegalzQueryVO queryVO) {
        AjaxSupport.sendSuccessText("success", pipeHighDepthService.queryPipeDepth(queryVO));
    }

    /**
     * 统计管道基础信息
     * @param queryVO
     * @return
     * @author axiao(xj08.dream@gmail.com)
     * @date 2016-11-16
     */
    @RequestMapping("/pipeInfo/query.json")
    @ResponseBody
    public void queryPipeInfo(IntegalzQueryVO queryVO) {
        AjaxSupport.sendSuccessText("success", pipeHighDepthService.queryPipeInfo(queryVO));
    }

    /**
     * 查询管段基础信息（电位测试桩、Mark定标点）
     * @param queryVO
     * @param model
     */
    @RequestMapping("/pipeInfoMP/query.json")
    @ResponseBody
    public void queryPipeInfo(IntegalzQueryVO queryVO,ModelMap model) {
        
        List<Map<String, Object>> pileList = pipeHighDepthService.queryPipeInfoPile(queryVO);
        model.addAttribute("pileList", pileList);
        
        List<Map<String, Object>> markList = pipeHighDepthService.queryPipeInfoMark(queryVO);
        model.addAttribute("markList", markList);
        
        List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
        list.addAll(pileList);
        list.addAll(markList);
        
        AjaxSupport.sendSuccessText("success", list);
    }

    
}
